package com.alex.jbpm.apply;

import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;

import junit.framework.TestCase;

public class IssueTest extends TestCase {
	
	static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
	
	
	/**
	 * 部署流程
	 */
	public void testDeployProcessDefinition() {

		ProcessDefinition processDef = ProcessDefinition
				.parseXmlResource("issue/issue_1.xml");

		// context对象类似于hibernate session对象的功能
		JbpmContext context = jbpmConfiguration.createJbpmContext();
		try {
			context.deployProcessDefinition(processDef);
		} finally {
			// context对象需要关闭
			context.close();
		}

	}
	
	/**
	 * 获取下发流程中的起始级别，用于对操作用户的行政级别进行验证
	
	public void testGetIssueStartLevel(){
		JbpmContext context = jbpmConfiguration.createJbpmContext();
		Transition tran = (Transition)processDef.getStartState().getLeavingTransitionsList().get(0);
		System.out.println(tran.getTo().getName());
	} */
	
}
